package com.se2.antiqueexhibition.Controller;

import com.se2.antiqueexhibition.Service.AnnouncementService;
import com.se2.antiqueexhibition.pojo.Announcement;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping
public class AnnouncementController {

    @Resource
    private AnnouncementService announcementService;

    @RequestMapping("/announcement")
    public String announcement(ModelMap model) {
        List<Announcement> announcements = announcementService.getAnnouncementList();
        model.addAttribute("announcements", announcements);
        return "announcement";
    }
}
